package cn.jdy.plugins.admin;

import cn.jdy.common.ctrl.BaseCtrl;
import cn.jdy.plugins.entity.District;
import cn.jdy.plugins.service.DistrictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * 行政区域控制类
 * Created by Tianyi on 2015/6/6.
 */
@Controller
@RequestMapping("/district")
public class DistrictCtrl extends BaseCtrl {

	@Autowired
	private DistrictService districtService;

	/**
	 * 获取下一级
	 * @param parent
	 * @return
	 */
	@RequestMapping("/queryChildren")
	@ResponseBody
	public List<District> queryChildren(String parent) {
		if(parent == null) parent = "0";
		return districtService.queryChildren(parent);
	}

}
